; *** Maze
; *** Copyright 1998-2002 Zillions Development
; v.2.0

; You need to purchase Zillions of Games to load this rules file
; Visit the Zillions web site at http://www.zillions-of-games.com

(version "2.0")
(translate
 ("Jack" " ") ("Magic" " ")
 ("man" "玩家") ("bricks" "墙") ("bush" "树丛") ("bench" "椅子") ("light" "灯")
 ("door" "单向门") ("teleporter" "传送门")
 ("Central Park" "第 1 关")
 ("Under Central Park" "第 2 关")
 ("The Teleporter" "第 3 关")
 ("Doors" "第 4 关")
)
; $1 is the direction to go
; $2 and $3 are sideways directions
(define to-intersection
   (
       $1
       (while empty?
         (if (or (not-friend? $2) (not-friend? $3) (friend? $1) (not-on-board? $1))
            add
         )
         $1
       )
   )
)

(variant
    (default)
    (title "Central Park")
	(solution "Solutions\Maze\CentralPark.zsg")

    (piece
        (image Jack "images\Maze\Bush.bmp")
        (name bush)
        (description "我觉得没有人会以为树丛可以钻的")
    )
    (piece
        (image Jack "images\Maze\Bench.bmp")
        (name bench)
        (description "让你出去，不是让你坐着休息→_→")
    )
    (piece
        (image Jack "images\Maze\Light.bmp")
        (name light)
        (description "就是个灯。别被闪瞎，快走")
    )
    (board-setup
     (Jack (man q2)
           (light   f10 c7 p16)
           (bench   f9 c8 k3)
		   (bush    a1      c1  d1  e1  f1  g1  h1  i1  j1  k1  l1  m1  n1  o1  p1  q1  r1
                    a2                  f2                          m2          p2      r2
                    a3  b3      d3      f3      h3  i3  j3                  o3  p3      r3
                    a4          d4              h4                  m4  n4      p4      r4
                    a5      c5  d5  e5  f5  g5  h5      j5  k5              o5  p5      r5
                    a6                  f6  g6  h6          k6  l6  m6          p6      r6
                    a7  b7          e7  f7  g7  h7  i7  j7  k7          n7      p7      r7
                    a8  b8          e8                                          p8      r8
                    a9              e9          h9  i9  j9  k9  l9  m9  n9  o9  p9      r9
                    a10     c10 d10 e10                         l10             p10     r10
                    a11             e11 f11 g11 h11 i11     k11 l11     n11     p11     r11
                    a12 b12 c12     e12                     k12         n12     p12     r12
                    a13             e13 f13 g13 h13 i13             m13 n13     p13     r13
                    a14 b14 c14 d14 e14             i14 j14 k14 l14             p14     r14
                    a15                     g15                         n15     p15     r15
                    a16     c16 d16 e16 f16 g16 h16 i16 j16 k16 l16 m16 n16 o16         r16
                    a17                                                                 r17
                    a18 b18 c18 d18 e18 f18 g18 h18 i18 j18 k18 l18 m18 n18 o18 p18 q18 r18
           )
	 )
    )
)

(game
    (title "Under Central Park")
    (description "走出迷宫即可。出口用五角星表示。")
    (strategy "If you keep your left hand on a wall, you can eventually get out of most mazes.")
    (history "Thanks to Ian Mallett for help making these mazes.")
    (solution "Solutions\Maze\UnderCentralPark.zsg")
    (option "progressive levels" true)
    (option "smart moves" true)
    (option "highlight goals" true)
    (option "animate captures" false)
    (win-sound "Audio\\Boing.wav")
    (move-sound "Audio\\Running.wav")
    (release-sound "Audio\\Running.wav")
    (change-sound "Audio\\AlienWavery.wav")
    (players Jack Magic)
    (turn-order Jack)
    (board
        (image "images\Maze\Blank18.bmp")
        (grid
            (start-rectangle 0 0 15 15) ; top-left position
            (dimensions
                ("a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r" (15 0)) ; columns
                ("18/17/16/15/14/13/12/11/10/9/8/7/6/5/4/3/2/1" (0 15)) ; rows
			)
			(directions (n 0 -1) (e 1 0) (s 0 1) (w -1 0))
		)
	)
    (piece
        (image Jack "images\Maze\Man.bmp")
        (name man)
        (description "为了方便，系统规定你只能直接走向一个分岔道（有多个方向可以走的地方）或者可以触发别的事件的点。")
        (moves
            (move-type moving)
            (to-intersection n e w)
            (to-intersection s e w)
            (to-intersection e n s)
            (to-intersection w n s)
        )			
    )
    (piece
        (image Jack "images\Maze\Bricks.bmp")
        (name bricks)
        (description "什么？你以为你有穿墙术？")
    )
    (piece
        (name teleporter)
        (image Magic "images\Maze\Teleporter.bmp")
        (description "传送门，可以把你传送至另外一个点。")
    )
    (piece
        (name door)
        (image Magic "images\Maze\Door.bmp")
        (description "单向门。只能从一个方向通过（就不告诉你哪个方向，咬我啊）")
    )
    (board-setup
      (Jack (man q15)
            (bricks
                    a18 b18 c18 d18 e18 f18 g18 h18 i18 j18 k18 l18 m18 n18 o18 p18 q18 r18
                    a17         d17         g17         j17     l17 m17                 r17
                    a16     c16     e16     g16     i16             m16     o16 p16 q16 r16
                    a15     c15                     i15 j15                             r15
                    a14                 f14 g14         j14 k14     m14 n14 o14 p14     r14
                    a13         d13     f13 g13 h13     j13                     p13     r13
                    a12 b12     d12             h12     j12 k12     m12     o12 p12     r12
                    a11         d11     f11     h11 i11 j11 k11     m11     o11         r11
                    a10 b10 c10 d10     f10                         m10     o10         r10
                    a9  b9      d9  e9  f9  g9  h9      j9  k9  l9  m9      o9      q9  r9
                    a8              e8  f8  g8  h8      j8                  o8      q8  r8
                    a7      c7      e7                  j7      l7  m7  n7              r7
                    a6      c6      e6      g6  h6  i6  j6      l6              p6      r6
                    a5      c5              g5  h5              l5  m5  n5      p5      r5
                    a4      c4  d4  e4  f4  g4          j4              n4  o4  p4      r4
                    a3          d3                  i3  j3      l3          o3          r3
                    a2      d2  e2      g2      i2  j2          l2  m2          p2  q2  r2
		    a1      c1  d1  e1  f1  g1  h1  i1  j1  k1  l1  m1  n1  o1  p1  q1  r1
             )
	  )
	)

    (win-condition (Jack) (absolute-config man (b1)) )
    (loss-condition (Jack) repetition )
)

(define to-intersection-teleport
   (
     $1
     (if (not-piece? door)
       (while (or empty? (piece? door))
         (if (or (not-friend? $2);(empty? $2) (piece? teleporter $2)
                 (not-friend? $3);empty? $3) (piece? teleporter $3)
                 (friend? $1)
                 (not-on-board? $1))
            add
         )
         $1
       )
       (if neutral?
         (change-type teleporter) flip
         (if (position? s15) (create ae11) else (if (position? z9) (create d4) else (create j31)))
         add
       )
     )
   )
)
(define large-maze-defs
    (board
        (image "images\Maze\Blank40.bmp")
        (grid
            (start-rectangle 0 0 15 15) ; top-left position
            (dimensions
                ("a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/aa/ab/ac/ad/ae/af/ag/ah" (15 0)) ; columns
                ("40/39/38/37/36/35/34/33/32/31/30/29/28/27/26/25/24/23/22/21/20/19/18/17/16/15/14/13/12/11/10/9/8/7/6/5/4/3/2/1" (0 15)) ; rows
            )
            (directions (n 0 -1) (e 1 0) (s 0 1) (w -1 0))
        )
    )
    (piece
        (image Jack "images\Maze\Man.bmp")
        (name man)
        (description "为了方便，系统规定你只能直接走向一个分岔道（有多个方向可以走的地方）或者可以触发别的事件的点。")
        (moves
            (move-type moving)
            (to-intersection-teleport n e w)
            (to-intersection-teleport s e w)
            (to-intersection-teleport e n s)
            (to-intersection-teleport w n s)
        )			
    )
)

(variant
    (title "The Teleporter")
    (solution "Solutions\Maze\TheTeleporter.zsg")
    (large-maze-defs)
    (board-setup
        (Magic (teleporter p11) (door c37 f22))
        (Jack (man b40)
        (bricks 

a40     c40             g40 h40 i40 j40 k40 l40 m40 n40 o40 p40 q40 r40 s40 t40 u40 v40 w40 x40 y40 z40 aa40 ab40 ac40 ad40 ae40 af40 ag40 ah40
a39     c39 d38 e39                             m39                                                                                        ah39
a38     c38     e38 f38 g38 h38 i38 j38 k38     m38     o38     q38         t38 u38 v38 w38 x38 y38 z38 aa38 ab38 ac38 ad38 ae38      ag38 ah38
a37                                     k37     m37 n37 o37 p37 q37 r37     t37                                   ac37      ae37           ah37  
a36     c36 d36 e36 f36 g36 h36 i36     k36     m36     o36     q36         t36     v36 w36 x36 y36 z36 aa36      ac36      ae36 af36      ah36
a35     c35                     i35     k35                             s35 t35                         aa35      ac35           af35      ah35 
a34     c34 d34 e34 f34 g34     i34     k34 l34 m34 n34 o34 p34 q34 r34 s34             w34 x34 y34     aa34      ac34 ad34      af34      ah34
a33     c33             g33     i33     k33                                     u33             y33     aa33           ad33      af33      ah33
a32     c32     e32     g32     i32     k32 l32 m32 n32 o32 p32 q32 r32 s32 t32 u32 v32 w32     y32     aa32 ab32 ac32 ad32      af32      ah32
a31     c31     e31             i31                                                             y31                                        ah31
a30     c30     e30 f30 g30 h30 i30 j30 k30 l30 m30 n30 o30 p30 q30 r30 s30 t30 u30 v30 w30 x30 y30 z30 aa30 ab30 ac30 ad30 ae30 af30 ag30 ah30
a29     c29                                                                                     y29                                        ah29
a28             e28 f28 g28 h28 i28 j28 k28 l28 m28 n28 o28 p28 q28 r28 s28 t28 u28 v28 w28     y28     aa28 ab28 ac28 ad28 ae28 af28 ag28 ah28
a27 b27 c27     e27                                 n27                                 w27                                                ah27           
a26                     g26 h26 i26 j26 k26 l26 m26 n26     p26 q26 r26 s26 t26 u26     w26 x26     z26 aa26 ab26 ac26 ad26 ae26 af26 ag26 ah26
a25     c25 d25 e25 f25 g25     i25     k25     m25         p25                         w25                                                ah25
a24     c24     e24                                     o24 p24     r24 s24 t24 u24 v24 w24     y24 z24 aa24 ab24 ac24 ad24 ae24 af24 ag24 ah24
a23     c23     e23 f23     h23 i23 j23 k23 l23 m23 n23 o23         r23                                                                    ah23
a22     c22                 h22                                 q22 r22 s22 t22 u22 v22 w22 x22 y22 z22 aa22 ab22 ac22      ae22 af22 ag22 ah22 
a21     c21     e21 f21 g21 h21 i21 j21 k21 l21 m21 n21 o21     q21                                                                        ah21 
a20                                                     o20     q20 r20 s20 t20 u20 v20 w20 x20 y20 z20 aa20 ab20 ac20 ad20 ae20 af20 ag20 ah20
a19 b19 c19 d19 e19 f19 g19 h19 i19 j19 k19 l19 m19     o19     q19                                                                        ah19
a18                                                     o18     q18     s18 t18 u18 v18 w18 x18 y18 z18 aa18 ab18 ac18 ad18 ae18 af18      ah18
a17     c17 d17 e17 f17 g17 h17 i17 j17 k17 l17 m17 n17 o17     q17     s17             w17                                                ah17
a16                                                     o16     q16     s16     u16     w16     y16 z16 aa16 ab16 ac16 ad16 ae16 af16      ah16      
a15     c15 d15 e15 f15 g15 h15 i15 j15 k15 l15 m15     o15     q15     s15     u15     w15     y15                              af15      ah15
a14                                     k14 l14         o14     q14     s14     u14     w14     y14     aa14 ab14 ac14 ad14      af14      ah14  
a13 b13 c13 d13 e13 f13 g13 h13 i13 j13 k13         n13 o13 p13 q13 r13 s13     u13     w13     y13                    ad13      af13      ah13
a12                                             m12 n12             r12 s12     u12     w12     y12 z12 aa12 ab12      ad12      af12      ah12        
a11     c11 d11 e11 f11 g11 h11 i11 j11 k11     m11                             u11     w11                            ad11      af11      ah11
a10                                     k10     m10 n10             r10 s10     u10     w10 x10 y10 z10 aa10 ab10 ac10 ad10      af10      ah10       
a9  b9  c9  d9  e9  f9  g9  h9  i9      k9      m9  n9  o9  p9  q9  r9  s9  t9  u9                                               af9       ah9   
a8                                      k8                                      u8  v8  w8  x8  y8  z8  aa8  ab8  ac8  ad8  ae8  af8       ah8                                                  
a7      c7  d7  e7  f7  g7  h7  i7  j7  k7  l7  m7  n7  o7  p7  q7  r7  s7                                                                 ah7
a6                                                          p6              t6  u6  v6  w6  x6  y6  z6  aa6  ab6  ac6  ad6  ae6  af6       ah6
a5  b5  c5  d5  e5  f5  g5  h5  i5  j5  k5  l5  m5  n5      p5      r5      t5                                                   af5       ah5
a4                                                  n4      p4      r4      t4      v4  w4  x4      z4  aa4  ab4       ad4       af4       ah4
a3      c3  d3  e3  f3  g3  h3  i3  j3  k3  l3  m3  n3  o3  p3      r3      t3      v3      x3  y3  z3       ab3  ac3  ad3       af3       ah3
a2                                                                  r2              v2                                                     ah2
a1  b1  c1  d1  e1  f1  g1  h1  i1  j1  k1  l1  m1  n1  o1  p1  q1  r1  s1  t1  u1  v1  w1  x1  y1  z1  aa1  ab1  ac1  ad1  ae1  af1  ag1  ah1
             )
      )
    )
    (win-condition (Jack) (absolute-config man (d40)) )
)

(variant
    (title "Doors")
    (solution "Solutions\Maze\Doors.zsg")
    (large-maze-defs)
    (board-setup
      (Magic (door d19 c17 d13 d11 f30 f32 f34 l19 q16 p36 x16 v9 z11 n6 ac4 m29 s20 z13 ab15 m15 w38)
             (teleporter b30 s15 z9 o7));
      (Jack (man a32)
      (bricks 
a40 b40 c40 d40 e40 f40 g40 h40 i40 j40 k40 l40 m40 n40 o40 p40 q40 r40 s40 t40 u40 v40 w40 x40 y40 z40 aa40 ab40 ac40 ad40 ae40 af40 ag40 ah40
a39                                         l39 m39 n39 o39 p39 q39 r39 s39 t39 u39 v39 w39 x39 y39 z39 aa39 ab39      ad39                ah39
a38     c38 d38 e38 f38 g38 h38     j38                                     t38                                        ad38      af38      ah38
a37                         h37     j37 k37 l37 m37 n37 o37 p37 q37 r37     t37 u37 v37 w37 x37 y37 z37 aa37 ab37      ad37      af37      ah37
a36     c36 d36 e36 f36     h36                                     r36                                 aa36 ab36      ad36      af36      ah36
a35     c35 d35 e35 f35     h35 i35 j35 k35 l35 m35 n35 o35 p35     r35 s35 t35 u35 v35 w35 x35 y35     aa35 ab35                af35      ah35
a34     c34                 h34             l34             p34                                 y34     aa34 ab34 ac34 ad34 ae34           ah34
a33 b33 c33     e33 f33 g33 h33     j33     l33     n33     p33 q33 r33 s33 t33 u33 v33 w33     y33                         ae33 af33      ah33
                                    j32             n32                                 w32     y32 z32 aa32 ab32 ac32           af32      ah32
a31 b31 c31     e31 f31 g31 h31 i31     k31 l31 m31 n31 o31 p31 q31     s31 t31 u31     w31                       ac31 ad31      af31      ah31
a30     c30                 h30     j30             n30             r30 s30     u30     w30 x30 y30 z30 aa30           ad30      af30      ah30
a29     c29 d29 e29 f29     h29     j29     l29     n29     p29     r29                 w29             aa29      ac29 ad29      af29      ah29
a28     c28 d28 e28 f28     h28     j28     l28     n28     p28     r28     t28 u28 v28 w28     y28     aa28           ad28      af28      ah28
a27                         h27             l27     n27     p27     r27     t27                 y27     aa27      ac27 ad27      af27      ah27
a26     c26 d26 e26 f26 g26 h26 i26 j26 k26 l26     n26             r26     t26     v26 w26 x26 y26     aa26           ad26      af26      ah26
a25                                         l25     n25     p25     r25     t25     v25                 aa25      ac25 ad25      af25      ah25
a24 b24 c24 d24 e24 f24 g24 h24 i24 j24     l24     n24     p24     r24     t24     v24 w24 x24 y24 z24 aa24           ad24      af24      ah24
a23                                 j23     l23             p23     r23     t23     v23                           ac23 ad23      af23      ah23
a22 b22 c22 d22 e22 f22 g22 h22     j22     l22 m22 n22 o22 p22     r22     t22     v22     x22 y22 z22      ab22 ac22           af22      ah22
a21                         h21     j21                     p21     r21     t21     v21     x21     z21           ac21      ae21 af21      ah21
a20     c20 d20 e20 f20     h20     j20 k20 l20 m20 n20     p20     r20     t20     v20     x20              ab20 ac20      ae20           ah20
a19                 f19     h19                     n19     p19             t19     v19     x19 y19 z19 aa19 ab19                af19      ah19
a18 b18 c18 d18     f18     h18     j18 k18 l18 m18 n18     p18 q18 r18 s18 t18     v18     x18     z18      ab18      ad18      af18      ah18
a17                 f17     h17                                                     v17     x17     z17                ad17      af17      ah17
a16     c16 d16 e16 f16     h16 i16 j16 k16 l16 m16 n16 o16 p16     r16 s16 t16     v16                 aa16 ab16 ac16 ad16      af16      ah16
a15                 f15                                     p15     r15     t15     v15     x15                        ad15      af15      ah15
a14     c14 d14 e14 f14     h14 i14 j14 k14 l14 m14 n14 o14 p14     r14     t14     v14     x14     z14 aa14 ab14 ac14 ad14      af14      ah14
a13                 f13     h13                                     r13     t13     v13     x13                                  af13      ah13
a12 b12 c12 d12     f12     h12     j12 k12 l12 m12 n12 o12 p12     r12     t12 u12 v12     x12 y12 z12 aa12 ab12 ac12 ad12 ae12 af12      ah12
a11                 f11     h11     j11                             r11                     x11                                  af11      ah11
a10     c10 d10 e10 f10     h10     j10     l10 m10 n10 o10 p10 q10 r10     t10 u10 v10 w10 x10     z10 aa10 ab10 ac10 ad10 ae10 af10      ah10
a9                          h9      j9                              r9                      x9          aa9                      af9       ah9
a8      c8  d8  e8  f8  g8  h8      j8  k8  l8  m8  n8  o8  p8          s8  t8  u8  v8  w8  x8  y8  z8  aa8       ac8       ae8  af8       ah8
a7                                  j7              n7      p7  q7              u7              y7                ac7            af7       ah7
a6      c6  d6  e6  f6  g6  h6  i6  j6      l6                          s6              w6              aa6       ac6            af6       ah6
a5      c5                  h5              l5      n5  o5  p5  q5  r5  s5  t5  u5  v5  w5  x5  y5  z5  aa5  ab5  ac5            af5       ah5
a4      c4          f4              j4      l4                                                                              ae4  af4       ah4
a3      c3  d3  e3  f3  g3  h3  i3  j3  k3  l3  m3  n3  o3  p3  q3  r3  s3  t3  u3  v3  w3  x3  y3  z3  aa3  ab3  ac3  ad3  ae3            ah3
a2                                                                                                                                    ag2  ah2
a1  b1  c1  d1  e1  f1  g1  h1  i1  j1  k1  l1  m1  n1  o1  p1  q1  r1  s1  t1  u1  v1  w1  x1  y1  z1  aa1  ab1  ac1  ad1  ae1  af1  ag1  ah1
      )))
    (win-condition (Jack) (absolute-config man (e15)) )
)

